using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Windy.TurtleDrawing;
using Windy.Transformations;
using System.Diagnostics.Contracts;
using System.Windows.Media;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Windows;

namespace Windy.DragonCurve
{
    public static class DrawActions
    {
        private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();

        private static void TraceTurtleStatus(this Turtle turtle, string message)
        {
            if (!logger.IsTraceEnabled)
                return;

            logger.Trace("{0} P:({1},{2}) A:{3}", message ?? string.Empty, turtle.Position.X, turtle.Position.Y, turtle.DirectionDegree);
        }

        public static void StepForward(DragonCurve curve, Turtle turtle)
        {
            turtle.MoveForward(curve.StepLength);
            turtle.TraceTurtleStatus("Step Forward");
        }

        public static void TurnLeft(DragonCurve curve, Turtle turtle)
        {
            turtle.TurnDegree(-curve.StepAngle);
            turtle.TraceTurtleStatus("Turn Left");
        }

        public static void TurnRight(DragonCurve curve, Turtle turtle)
        {
            turtle.TurnDegree(curve.StepAngle);
            turtle.TraceTurtleStatus("Turn Right");
        }
    }
}
